<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>
            我自己做的后台管理中心
        </title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="/php/Fly/Public/admin/css/x-admin.css" media="all">
        <script src="/php/Fly/Public/Admin/lib/layui/layui.js" charset="utf-8"></script>
        <script src="/php/Fly/Public/admin/js/x-layui.js" charset="utf-8"></script>
    </head>
    <body>

            <div class="x-body">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label for="L_email" class="layui-form-label">
                        邮箱
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_email" name="email" required lay-verify="email"
                        autocomplete="off" value="<?php echo $data['email'] ?>" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">
                        如果您在邮箱已激活的情况下，变更了邮箱，需
                        <a href="/user/activate/" style="font-size: 12px; color: #4f99cf;">
                            重新验证邮箱
                        </a>
                        。
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_username" class="layui-form-label">
                        昵称
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_username" name="nickname" required lay-verify="required"
                        autocomplete="off" value=" <?php echo $data['nickname'] ?>" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="radio" name="sex" value="男" <?php if($data['sex']=="男"){echo "checked";} ?> title="男">
                            <input type="radio" name="sex" value="女" <?php if($data['sex']=="女"){echo "checked";} ?> title="女">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="L_city" class="layui-form-label">
                        城市
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="L_city" name="city" autocomplete="off" value="<?php echo $data['city'] ?>"
                        class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label for="L_sign" class="layui-form-label">
                        签名
                    </label>
                    <div class="layui-input-block">
                        <textarea placeholder="随便写些什么刷下存在感" id="L_sign" name="sign" autocomplete="off"
                        class="layui-textarea" style="height: 80px;"><?php echo $data['sign'] ?></textarea>
                    </div>
                </div>
                <div class="layui-form-item"> 
                    <label for="L_sign" class="layui-form-label">
                    </label>
                    <button class="layui-btn uid" uid="<?php echo $data['id'] ?>" key="set-mine" lay-filter="save" lay-submit>
                        保存
                    </button>
                </div>
            </form>
        </div>
        <script type="text/javascript">
        layui.use(["layer", "form", "jquery","element"],function() {
        
            var layer = layui.layer;
            var form = layui.form();
            var $ = layui.jquery;
            var element = layui.element();
            //监听提交
            form.on('submit(save)',function(data) {
                uid=$(this).attr('uid');
                 data.field.uid=uid;
                $.ajax({
                    url: '<?php echo U('admin/user/add');?>',
                    type: 'POST',
                    dataType: 'json',
                    data: data.field,
                })
                .done(function(respones) {
                    if (respones.error == 1) {
                        layer.msg(respones.info,
                        function() {});
                    } else {
                        //把成功信息弹出，并中转到shouye页面
                        layer.alert(respones.info, {
                            icon: 6
                        },
                        function() {
                            location.replace('<?php echo U('admin/user/useredit');?>')
                        })
                    }
                })
                .fail(function() {
                    console.log("error");
                }) 
                return false;
            });
        });
</script>







    </body>
</html>